package com.example.laboratory.ui.user.Record;

import android.content.Intent;
import android.os.Bundle;
import com.example.laboratory.R;
import com.example.laboratory.bean.Record;
import com.example.laboratory.common.Const;
import com.example.laboratory.inter.OnRecordListItemClickListener;
import com.example.laboratory.ui.adapter.BaseListAdapter;
import com.example.laboratory.ui.adapter.RecordListAdapter;
import com.example.laboratory.ui.base.BaseAbListActivity;
import com.example.laboratory.ui.result.ResultActivity;

import java.util.List;

public class RecordListActivity extends BaseAbListActivity<RecordPresenter, Record.RecordListBean> implements RecordContract.IRecordView, OnRecordListItemClickListener {
    @Override
    protected boolean initToolbar() {
        mToolbar.setTitle(R.string.xj_records);
        return true;
    }
    @Override
    protected RecordPresenter createPresenter() {
        return new RecordPresenter();
    }

    @Override
    protected void loadDatas() {
        mPresenter.loadRecordList();
    }



    @Override
    public void setData(List<Record.RecordListBean> data) {
        mListData.clear();
        mListData.addAll(data);
    }

    @Override
    protected BaseListAdapter<Record.RecordListBean> getListAdapter() {
        return new RecordListAdapter(this);
    }


    @Override
    public void onRecordClick(int position, String id) {

    }

    @Override
    public void onItemClick(int position, Record.RecordListBean bean) {
        Intent intent = new Intent(this, ResultActivity.class);
        Bundle bundle = new Bundle();
        bundle.putSerializable(Const.BUNDLE_KEY.OBJ, bean);
        intent.putExtras(bundle);
        startActivity(intent);
    }
}
